<?php
/* @var $this ReservationController */
/* @var $model Reservation */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'reservation-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'customer_id'); ?>
		<?php echo $form->dropDownList($model, 'customer_id', CHtml::listData(
		Customer::model()->findAll(), 'id', 'name'),
		array('prompt' => 'Select a Customer:')
		); ?>
		<?php echo $form->error($model,'customer_id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'employee_id'); ?>
		<?php echo $form->dropDownList($model, 'employee_id', CHtml::listData(
		Employee::model()->findAll(), 'id', 'name'),
		array('prompt' => 'Select a Employee:')
		); ?>
		<?php echo $form->error($model,'employee_id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'reservation_details_id'); ?>
		<?php echo $form->dropDownList($model, 'reservation_details_id', CHtml::listData(
		ReservationDetails::model()->findAll(), 'id', 'id'),
		array('prompt' => 'Select a Reservation:')
		); ?>
		<?php echo $form->error($model,'reservation_details_id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'type'); ?>
		<?php echo $form->textField($model,'type',array('size'=>45,'maxlength'=>45)); ?>
		<?php echo $form->error($model,'type'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'date'); ?>
		<?php $form->widget('zii.widgets.jui.CJuiDatePicker', array(
        'model'=>$model,
        'attribute'=>'date',
        'name'=>$model->date,    // This is how it works for me.
        'value'=>$model->date,
        'options'=>array('dateFormat'=>'yy-mm-dd', 
                        'altFormat'=>'dd-mm-yy', 
                        'changeMonth'=>'true', 
                        'changeYear'=>'true', 
                        'yearRange'=>'2000:2020', 
                        'showOn'=>'both',
                        'buttonText'=>'Input Date'),
        'htmlOptions'=>array('size'=>'10')
   )); ?>
		<?php echo $form->error($model,'date'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'no_of_guests'); ?>
		<?php echo $form->textField($model,'no_of_guests'); ?>
		<?php echo $form->error($model,'no_of_guests'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'no_of_table'); ?>
		<?php echo $form->textField($model,'no_of_table'); ?>
		<?php echo $form->error($model,'no_of_table'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'no_of_chair'); ?>
		<?php echo $form->textField($model,'no_of_chair'); ?>
		<?php echo $form->error($model,'no_of_chair'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'start_time'); ?>
		<?php echo $form->textField($model,'start_time'); ?>
		<?php echo $form->error($model,'start_time'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'end_time'); ?>
		<?php echo $form->textField($model,'end_time'); ?>
		<?php echo $form->error($model,'end_time'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'note'); ?>
		<?php echo $form->textField($model,'note',array('size'=>60,'maxlength'=>445)); ?>
		<?php echo $form->error($model,'note'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->